package com.yly.common.basic.action;

import java.io.IOException;
import java.util.Map;

import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;
import org.apache.struts2.interceptor.SessionAware;

import com.yly.common.basic.pojo.PageParameter;
import com.yly.constant.Constant;
import com.yly.utils.StrUtil;
import com.yly.utils.ThreadLocalUtil;
import com.yly.utils.staticpage.SupportBasicStaticPage;

import freemarker.template.TemplateException;


@SuppressWarnings("serial")
public class BasicSupportAction extends BasicAction {

	private static final String ENCODING = Constant.SP_ENCODING;
	
	public BasicSupportAction() {

	}

	protected void write(String str) {
		try {
			this.getResponse().getWriter().write(str);
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}

	protected PageParameter getPage(){
		return (PageParameter)ThreadLocalUtil.get("param.pageParameter");
	}
	
	protected void createStaticPage(String templatePathAndName, String tagNameAndName, Map dataMap) throws TemplateException, IOException{
		this.createStaticPage(templatePathAndName, tagNameAndName, dataMap, ENCODING);
	}
	
	protected void createStaticPage(String templatePathAndName, String tagNameAndName, Map dataMap, String encoding) throws TemplateException, IOException{
		SupportBasicStaticPage.createStaticPage(templatePathAndName, tagNameAndName, dataMap, encoding);
	}
}
